<template>
	<view class="imgbox" @click="showImg(src)">
		<image :src="src" :mode="mode"></image>
	</view>
</template>

<script>
	export default {
		name:"PicturePreview",
		props:{
			src:{
				type:String,
				default:null,
			},
			srcList:{
				type:Array,
				default:null,
			},
			mode:{
				type:String,
				default:'aspectFill',
			}
		},
		data() {
			return {
				showImg(src){
					uni.previewImage({
						urls:[src],
						longPressActions: {
							itemList: ['发送给朋友', '保存图片', '收藏'],
							success: function(data) {
								console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
							},
							fail: function(err) {
								console.log(err.errMsg);
							}
						}
					});
				}
			};
		}
	}
</script>

<style scoped lang="less">
	.imgbox{
		width: 100%;
		height: 100%;
		image{
			width: 100%;
			height: 100%;
		}
	}

</style>